

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>配置 Ceph &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="通用选项" href="../common/" />
    <link rel="prev" title="存储设备" href="../storage-devices/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../../">Ceph 存储集群</a> &raquo;</li>
        
          <li><a href="../">配置</a> &raquo;</li>
        
      <li>配置 Ceph</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../../_sources/rados/configuration/ceph-conf.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../">
          

          
            
            <img src="../../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">Ceph 存储集群</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="../">配置</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../storage-devices/">存储设备</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">配置 Ceph</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id1">选项名</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id2">配置来源</a></li>
<li class="toctree-l4"><a class="reference internal" href="#ceph-conf-file">配置段落</a></li>
<li class="toctree-l4"><a class="reference internal" href="#ceph-metavariables">元变量</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id7">配置文件</a></li>
<li class="toctree-l4"><a class="reference internal" href="#ceph-conf-settings">配置文件段落</a></li>
<li class="toctree-l4"><a class="reference internal" href="#ceph-conf-database">监视器配置数据库</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id13">帮助信息</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id14">运行时改配置</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id16">查看运行时配置</a></li>
<li class="toctree-l4"><a class="reference internal" href="#nautilus">nautilus 以来的变化</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../common/">通用选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#ceph-network-config">网络</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#id3">监视器</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#ceph-osd-config">认证</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#osds">OSDs</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#id5">心跳</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#ceph-logging-and-debugging">日志记录、调试</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#ceph-conf">ceph.conf 实例</a></li>
<li class="toctree-l3"><a class="reference internal" href="../common/#ceph-runtime-config">跑多个集群（已废弃）</a></li>
<li class="toctree-l3"><a class="reference internal" href="../network-config-ref/">网络选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../msgr2/">信使协议 v2</a></li>
<li class="toctree-l3"><a class="reference internal" href="../auth-config-ref/">认证选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mon-config-ref/">监视器选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mon-lookup-dns/">通过 DNS 查询监视器</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mon-osd-interaction/">心跳选项（监视器与 OSD 的的交互）</a></li>
<li class="toctree-l3"><a class="reference internal" href="../osd-config-ref/">OSD 选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mclock-config-ref/">DmClock 配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../bluestore-config-ref/">BlueStore 配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../filestore-config-ref/">FileStore 配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../journal-ref/">日志选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pool-pg-config-ref/">存储池、归置组和 CRUSH 选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../general-config-ref/">常规选项</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../operations/">运维</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../man/">    手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../troubleshooting/">故障排除</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../api/">APIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="ceph">
<span id="configuring-ceph"></span><h1>配置 Ceph<a class="headerlink" href="#ceph" title="Permalink to this headline">¶</a></h1>
<p>你启动 Ceph 服务时，
初始化进程会把一系列守护进程放到后台运行。
<a class="reference internal" href="../../../glossary/#term-7"><span class="xref std std-term">Ceph 存储集群</span></a>运行三种守护进程：</p>
<ul class="simple">
<li><p><a class="reference internal" href="../../../glossary/#term-24"><span class="xref std std-term">Ceph 监视器</span></a> （ <code class="docutils literal notranslate"><span class="pre">ceph-mon</span></code> ）</p></li>
<li><p><a class="reference internal" href="../../../glossary/#term-26"><span class="xref std std-term">Ceph 管理器</span></a> （ <code class="docutils literal notranslate"><span class="pre">ceph-mgr</span></code> ）</p></li>
<li><p><a class="reference internal" href="../../../glossary/#term-23"><span class="xref std std-term">Ceph OSD 守护进程</span></a> （ <code class="docutils literal notranslate"><span class="pre">ceph-osd</span></code> ）</p></li>
</ul>
<p>支持 <a class="reference internal" href="../../../glossary/#term-18"><span class="xref std std-term">Ceph 文件系统</span></a>的 Ceph 存储集群至少运行着一个
<a class="reference internal" href="../../../glossary/#term-33"><span class="xref std std-term">Ceph 元数据服务器</span></a>（ <code class="docutils literal notranslate"><span class="pre">ceph-mds</span></code> ）。支持
<a class="reference internal" href="../../../glossary/#term-13"><span class="xref std std-term">Ceph 对象存储</span></a>的集群需运行 Ceph 网关守护进程（ <code class="docutils literal notranslate"><span class="pre">radosgw</span></code> ）。</p>
<p>各个守护进程都有一系列配置选项，各选项都有其默认值。
你可以更改这些配置选项，以调整系统行为。
覆盖默认值前应该深入理解可能产生的后果，
因为有可能显著降低集群的性能和稳定性。
还要注意后续版本的默认值可能会变，所以，
最好回顾一下与你的 Ceph 版本相对应的文档。</p>
<div class="section" id="id1">
<h2>选项名<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
<p>All Ceph configuration options have a unique name consisting of words
formed with lower-case characters and connected with underscore
(<code class="docutils literal notranslate"><span class="pre">_</span></code>) characters.</p>
<p>When option names are specified on the command line, either underscore
(<code class="docutils literal notranslate"><span class="pre">_</span></code>) or dash (<code class="docutils literal notranslate"><span class="pre">-</span></code>) characters can be used interchangeable (e.g.,
<code class="docutils literal notranslate"><span class="pre">--mon-host</span></code> is equivalent to <code class="docutils literal notranslate"><span class="pre">--mon_host</span></code>).</p>
<p>When option names appear in configuration files, spaces can also be
used in place of underscore or dash.  We suggest, though, that for
clarity and convenience you consistently use underscores, as we do
throughout this documentation.</p>
</div>
<div class="section" id="id2">
<h2>配置来源<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2>
<p>每个 Ceph 守护进程、进程、和库都从好几个来源获取它的配置信息，在下面列出了。
列表里位于后面的会覆盖靠前的同一选项。</p>
<ul class="simple">
<li><p>编译时内建的默认值</p></li>
<li><p>监视器集群的中央配置数据库</p></li>
<li><p>本地主机上的配置文件</p></li>
<li><p>环境变量</p></li>
<li><p>命令行参数</p></li>
<li><p>管理员在运行时覆盖的</p></li>
</ul>
<p>一个 Ceph 进程启动时有很多事，其中的第一步就是分析命令行、
环境变量和本地配置文件提供的配置选项。之后它会联系监视器集群，
以获取它为整个集群集中存储的配置信息。获取到整个配置的完整视图之后，
守护进程或者进程的启动就会继续。</p>
<div class="section" id="bootstrap-options">
<span id="id3"></span><h3>自举引导选项<a class="headerlink" href="#bootstrap-options" title="Permalink to this headline">¶</a></h3>
<p>Some configuration options affect the process’s ability to contact the
monitors, to authenticate, and to retrieve the cluster-stored configuration.
For this reason, these options might need to be stored locally on the node, and
set by means of a local configuration file. These options include the
following:</p>
<dl class="std confval">
<dt id="confval-mon_host">
<code class="sig-name descname"><span class="pre">mon_host</span></code><a class="headerlink" href="#confval-mon_host" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>This is a list of IP addresses or hostnames that are separated by
commas, whitespace, or semicolons. Hostnames are resolved via DNS. All
A and AAAA records are included in the search list.</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<dl class="std confval">
<dt id="confval-mon_host_override">
<code class="sig-name descname"><span class="pre">mon_host_override</span></code><a class="headerlink" href="#confval-mon_host_override" title="Permalink to this definition">¶</a></dt>
<dd><blockquote>
<div><p>This is the list of monitors that the Ceph process <strong>initially</strong>
contacts when first establishing communication with the Ceph cluster.
This overrides the known monitor list that is derived from MonMap
updates sent to older Ceph instances (like librados cluster handles).
This option is expected to be useful primarily for debugging.</p>
<dl class="field-list simple">
<dt class="field-odd">type</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">str</span></code></p>
</dd>
</dl>
</div></blockquote>
</dd></dl>

<ul class="simple">
<li><p><a class="reference internal" href="../mon-lookup-dns/#confval-mon_dns_srv_name"><code class="xref std std-confval docutils literal notranslate"><span class="pre">mon_dns_srv_name</span></code></a></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">mon_data</span></code>, <code class="docutils literal notranslate"><span class="pre">osd_data</span></code>, <code class="docutils literal notranslate"><span class="pre">mds_data</span></code>, <code class="docutils literal notranslate"><span class="pre">mgr_data</span></code>, and
similar options that define which local directory the daemon
stores its data in.</p></li>
<li><p><a class="reference internal" href="../auth-config-ref/#confval-keyring"><code class="xref std std-confval docutils literal notranslate"><span class="pre">keyring</span></code></a>, <a class="reference internal" href="../auth-config-ref/#confval-keyfile"><code class="xref std std-confval docutils literal notranslate"><span class="pre">keyfile</span></code></a>, and/or <a class="reference internal" href="../auth-config-ref/#confval-key"><code class="xref std std-confval docutils literal notranslate"><span class="pre">key</span></code></a>, which can be used to
specify the authentication credential to use to authenticate with
the monitor.  Note that in most cases the default keyring location
is in the data directory specified above.</p></li>
</ul>
<p>大多数情况下，这些选项的默认值都是恰当的。有一个例外：
用于指示集群监视器地址的 <a class="reference internal" href="#confval-mon_host"><code class="xref std std-confval docutils literal notranslate"><span class="pre">mon_host</span></code></a>  选项。
使用 DNS 来查找监视器时，可以完全忽视本地配置文件。</p>
</div>
<div class="section" id="id4">
<h3>跳过监视器配置<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h3>
<p>给进程加 <code class="docutils literal notranslate"><span class="pre">--no-mon-config</span></code> 选项之后，
它就会不会向集群的监视器们索要配置信息了。
在某些时候需要用到，比如完全靠配置文件管理配置信息时、
或者监视器集群挂了却需要进行一些维护活动。</p>
</div>
</div>
<div class="section" id="ceph-conf-file">
<span id="id5"></span><h2>配置段落<a class="headerlink" href="#ceph-conf-file" title="Permalink to this headline">¶</a></h2>
<p>Any given process or daemon has a single value for each configuration
option.  However, values for an option may vary across different
daemon types even daemons of the same type.  Ceph options that are
stored in the monitor configuration database or in local configuration
files are grouped into sections to indicate which daemons or clients
they apply to.</p>
<p>These sections include:</p>
<dl class="std confsec">
<dt id="confsec-global">
<code class="sig-name descname"><span class="pre">global</span></code><a class="headerlink" href="#confsec-global" title="Permalink to this definition">¶</a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">global</span></code> 下的配置选项影响 Ceph 存储集群里的所有守护进程和客户端。</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">log_file</span> <span class="pre">=</span> <span class="pre">/var/log/ceph/$cluster-$type.$id.log</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="std confsec">
<dt id="confsec-mon">
<code class="sig-name descname"><span class="pre">mon</span></code><a class="headerlink" href="#confsec-mon" title="Permalink to this definition">¶</a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">mon</span></code> 下的配置影响 Ceph 集群里的所有 <code class="docutils literal notranslate"><span class="pre">ceph-mon</span></code> 守护进程，
并且会覆盖 <code class="docutils literal notranslate"><span class="pre">global</span></code> 下的同一选项。</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">mon_cluster_log_to_syslog</span> <span class="pre">=</span> <span class="pre">true</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="std confsec">
<dt id="confsec-mgr">
<code class="sig-name descname"><span class="pre">mgr</span></code><a class="headerlink" href="#confsec-mgr" title="Permalink to this definition">¶</a></dt>
<dd><p>Settings in the <code class="docutils literal notranslate"><span class="pre">mgr</span></code> section affect all <code class="docutils literal notranslate"><span class="pre">ceph-mgr</span></code> daemons in
the Ceph Storage Cluster, and override the same setting in
<code class="docutils literal notranslate"><span class="pre">global</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">mgr_stats_period</span> <span class="pre">=</span> <span class="pre">10</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="std confsec">
<dt id="confsec-osd">
<code class="sig-name descname"><span class="pre">osd</span></code><a class="headerlink" href="#confsec-osd" title="Permalink to this definition">¶</a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">osd</span></code> 下的配置影响 Ceph 存储集群里的所有 <code class="docutils literal notranslate"><span class="pre">ceph-osd</span></code> 守护进程，
并且会覆盖 <code class="docutils literal notranslate"><span class="pre">global</span></code> 下的同一选项。</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">osd_op_queue</span> <span class="pre">=</span> <span class="pre">wpq</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="std confsec">
<dt id="confsec-mds">
<code class="sig-name descname"><span class="pre">mds</span></code><a class="headerlink" href="#confsec-mds" title="Permalink to this definition">¶</a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">mds</span></code> 下的配置影响 Ceph 存储集群里的所有 <code class="docutils literal notranslate"><span class="pre">ceph-mds</span></code>
守护进程，并且会覆盖 <code class="docutils literal notranslate"><span class="pre">global</span></code> 下的同一选项。</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">mds_cache_memory_limit</span> <span class="pre">=</span> <span class="pre">10G</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="std confsec">
<dt id="confsec-client">
<code class="sig-name descname"><span class="pre">client</span></code><a class="headerlink" href="#confsec-client" title="Permalink to this definition">¶</a></dt>
<dd><p><code class="docutils literal notranslate"><span class="pre">[client]</span></code> 下的配置影响所有 Ceph 客户端
（如挂载的 Ceph 文件系统、挂载的块设备等等）、
也影响 Rados 网关（ RGW ）守护进程。</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">objecter_inflight_ops</span> <span class="pre">=</span> <span class="pre">512</span></code></p>
</dd>
</dl>
</dd></dl>

<p>Sections may also specify an individual daemon or client name.  For example,
<code class="docutils literal notranslate"><span class="pre">mon.foo</span></code>, <code class="docutils literal notranslate"><span class="pre">osd.123</span></code>, and <code class="docutils literal notranslate"><span class="pre">client.smith</span></code> are all valid section names.</p>
<p>Any given daemon will draw its settings from the global section, the
daemon or client type section, and the section sharing its name.
Settings in the most-specific section take precedence, so for example
if the same option is specified in both <a class="reference internal" href="#confsec-global"><code class="xref std std-confsec docutils literal notranslate"><span class="pre">global</span></code></a>, <a class="reference internal" href="#confsec-mon"><code class="xref std std-confsec docutils literal notranslate"><span class="pre">mon</span></code></a>, and
<code class="docutils literal notranslate"><span class="pre">mon.foo</span></code> on the same source (i.e., in the same configurationfile),
the <code class="docutils literal notranslate"><span class="pre">mon.foo</span></code> value will be used.</p>
<p>If multiple values of the same configuration option are specified in the same
section, the last value wins.</p>
<p>Note that values from the local configuration file always take
precedence over values from the monitor configuration database,
regardless of which section they appear in.</p>
</div>
<div class="section" id="ceph-metavariables">
<span id="id6"></span><h2>元变量<a class="headerlink" href="#ceph-metavariables" title="Permalink to this headline">¶</a></h2>
<p>元变量大大简化了 Ceph 集群配置。如果在配置值里设置了元变量，
Ceph 会在使用此配置值时把相应的元变量展开为具体值。Ceph 元变量类似于 Bash shell 的变量展开。</p>
<p>Ceph 支持下列元变量：</p>
<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">$cluster</span></code></dt>
<dd><p>展开为存储集群的名字，
在同一套硬件上运行多个集群时有用。</p>
<p>:example:<code class="docutils literal notranslate"><span class="pre">/etc/ceph/$cluster.keyring</span></code>
:default:<code class="docutils literal notranslate"><span class="pre">ceph</span></code></p>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">$type</span></code></dt>
<dd><p>可展开为守护进程或进程类型，如 <code class="docutils literal notranslate"><span class="pre">mds</span></code> 、 <code class="docutils literal notranslate"><span class="pre">osd</span></code> 、 <code class="docutils literal notranslate"><span class="pre">mon</span></code> 。</p>
<p>:example:<code class="docutils literal notranslate"><span class="pre">/var/lib/ceph/$type</span></code></p>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">$id</span></code></dt>
<dd><p>展开为守护进程或客户端标识符；
<code class="docutils literal notranslate"><span class="pre">osd.0</span></code> 应为 <code class="docutils literal notranslate"><span class="pre">0</span></code> ， <code class="docutils literal notranslate"><span class="pre">mds.a</span></code> 是 <code class="docutils literal notranslate"><span class="pre">a</span></code> 。</p>
<p>:example:<code class="docutils literal notranslate"><span class="pre">/var/lib/ceph/$type/$cluster-$id</span></code></p>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">$host</span></code></dt>
<dd><p>展开为当前守护进程的主机名。</p>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">$name</span></code></dt>
<dd><p>展开为 <code class="docutils literal notranslate"><span class="pre">$type.$id</span></code> 。</p>
<p>:example:<code class="docutils literal notranslate"><span class="pre">/var/run/ceph/$cluster-$name.asok</span></code></p>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">$pid</span></code></dt>
<dd><p>展开为守护进程的 pid 。</p>
<p>:example:<code class="docutils literal notranslate"><span class="pre">/var/run/ceph/$cluster-$name-$pid.asok</span></code></p>
</dd></dl>

</div>
<div class="section" id="id7">
<h2>配置文件<a class="headerlink" href="#id7" title="Permalink to this headline">¶</a></h2>
<p>启动时， Ceph 的各进程会依次到下列位置搜索配置文件：</p>
<ol class="arabic simple">
<li><p><code class="docutils literal notranslate"><span class="pre">$CEPH_CONF</span></code> （<em>就是</em> <code class="docutils literal notranslate"><span class="pre">$CEPH_CONF</span></code> 环境变量所指示的路径）；</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">-c</span> <span class="pre">path/path</span></code>  （<em>就是</em> <code class="docutils literal notranslate"><span class="pre">-c</span></code> 命令行参数）；</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">/etc/ceph/$cluster.conf</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">~/.ceph/$cluster.conf</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">./$cluster.conf</span></code> （<em>就是</em>当前的工作路径）。</p></li>
<li><p>对 FreeBSD 而言， <code class="docutils literal notranslate"><span class="pre">/usr/local/etc/ceph/$cluster.conf</span></code></p></li>
</ol>
<p>其中， <code class="docutils literal notranslate"><span class="pre">$cluster</span></code> 代表集群名（默认为 <code class="docutils literal notranslate"><span class="pre">ceph</span></code> ）。</p>
<p>Ceph 配置文件使用 <em>ini</em> 风格的语法，以分号 (;) 和井号 (#) 开始的行是注释，如下：</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="c1"># &lt;--A number (#) sign precedes a comment.</span>
<span class="c1">; A comment may be anything.</span>
<span class="c1"># Comments always follow a semi-colon (;) or a pound (#) on each line.</span>
<span class="c1"># The end of the line terminates a comment.</span>
<span class="c1"># We recommend that you provide comments in your configuration file(s).</span>
</pre></div>
</div>
</div>
<div class="section" id="ceph-conf-settings">
<span id="id8"></span><h2>配置文件段落<a class="headerlink" href="#ceph-conf-settings" title="Permalink to this headline">¶</a></h2>
<p>The configuration file is divided into sections. Each section must begin with a
valid configuration section name (see <a class="reference internal" href="#id5">配置段落</a>, above)
surrounded by square brackets. For example,</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[global]</span>
<span class="na">debug ms</span> <span class="o">=</span> <span class="s">0</span>

<span class="k">[osd]</span>
<span class="na">debug ms</span> <span class="o">=</span> <span class="s">1</span>

<span class="k">[osd.1]</span>
<span class="na">debug ms</span> <span class="o">=</span> <span class="s">10</span>

<span class="k">[osd.2]</span>
<span class="na">debug ms</span> <span class="o">=</span> <span class="s">10</span>
</pre></div>
</div>
<div class="section" id="id9">
<h3>配置文件选项的值<a class="headerlink" href="#id9" title="Permalink to this headline">¶</a></h3>
<p>The value of a configuration option is a string. If it is too long to
fit in a single line, you can put a backslash (<code class="docutils literal notranslate"><span class="pre">\</span></code>) at the end of line
as the line continuation marker, so the value of the option will be
the string after <code class="docutils literal notranslate"><span class="pre">=</span></code> in current line combined with the string in the next
line:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="k">global</span><span class="p">]</span>
<span class="n">foo</span> <span class="o">=</span> <span class="n">long</span> <span class="n">long</span> <span class="n">ago</span>\
<span class="n">long</span> <span class="n">ago</span>
</pre></div>
</div>
<p>In the example above, the value of “<code class="docutils literal notranslate"><span class="pre">foo</span></code>” would be “<code class="docutils literal notranslate"><span class="pre">long</span> <span class="pre">long</span> <span class="pre">ago</span> <span class="pre">long</span> <span class="pre">ago</span></code>”.</p>
<p>Normally, the option value ends with a new line, or a comment, like</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[global]</span>
<span class="na">obscure one</span> <span class="o">=</span> <span class="s">difficult to explain # I will try harder in next release</span>
<span class="na">simpler one</span> <span class="o">=</span> <span class="s">nothing to explain</span>
</pre></div>
</div>
<p>In the example above, the value of “<code class="docutils literal notranslate"><span class="pre">obscure</span> <span class="pre">one</span></code>” would be “<code class="docutils literal notranslate"><span class="pre">difficult</span> <span class="pre">to</span> <span class="pre">explain</span></code>”;
and the value of “<code class="docutils literal notranslate"><span class="pre">simpler</span> <span class="pre">one</span></code> would be “<code class="docutils literal notranslate"><span class="pre">nothing</span> <span class="pre">to</span> <span class="pre">explain</span></code>”.</p>
<p>If an option value contains spaces, and we want to make it explicit, we
could quote the value using single or double quotes, like</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[global]</span>
<span class="na">line</span> <span class="o">=</span> <span class="s">&quot;to be, or not to be&quot;</span>
</pre></div>
</div>
<p>Certain characters are not allowed to be present in the option values directly.
They are <code class="docutils literal notranslate"><span class="pre">=</span></code>, <code class="docutils literal notranslate"><span class="pre">#</span></code>, <code class="docutils literal notranslate"><span class="pre">;</span></code> and <code class="docutils literal notranslate"><span class="pre">[</span></code>. If we have to, we need to escape them,
like</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[global]</span>
<span class="na">secret</span> <span class="o">=</span> <span class="s">&quot;i love \# and \[&quot;</span>
</pre></div>
</div>
<p>Every configuration option is typed with one of the types below:</p>
<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">int</span></code></dt>
<dd><p>64-bit signed integer, Some SI prefixes are supported, like “K”, “M”, “G”,
“T”, “P”, “E”, meaning, respectively, 10<sup>3</sup>, 10<sup>6</sup>,
10<sup>9</sup>, etc.  And “B” is the only supported unit. So, “1K”, “1M”, “128B” and “-1” are all valid
option values. Some times, a negative value implies “unlimited” when it comes to
an option for threshold or limit.</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">42</span></code>, <code class="docutils literal notranslate"><span class="pre">-1</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">uint</span></code></dt>
<dd><p>It is almost identical to <code class="docutils literal notranslate"><span class="pre">integer</span></code>. But a negative value will be rejected.</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">256</span></code>, <code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">str</span></code></dt>
<dd><p>Free style strings encoded in UTF-8, but some characters are not allowed. Please
reference the above notes for the details.</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">&quot;hello</span> <span class="pre">world&quot;</span></code>, <code class="docutils literal notranslate"><span class="pre">&quot;i</span> <span class="pre">love</span> <span class="pre">\#&quot;</span></code>, <code class="docutils literal notranslate"><span class="pre">yet-another-name</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">boolean</span></code></dt>
<dd><p>one of the two values <code class="docutils literal notranslate"><span class="pre">true</span></code> or <code class="docutils literal notranslate"><span class="pre">false</span></code>. But an integer is also accepted,
where “0” implies <code class="docutils literal notranslate"><span class="pre">false</span></code>, and any non-zero values imply <code class="docutils literal notranslate"><span class="pre">true</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">true</span></code>, <code class="docutils literal notranslate"><span class="pre">false</span></code>, <code class="docutils literal notranslate"><span class="pre">1</span></code>, <code class="docutils literal notranslate"><span class="pre">0</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">addr</span></code></dt>
<dd><p>a single address optionally prefixed with <code class="docutils literal notranslate"><span class="pre">v1</span></code>, <code class="docutils literal notranslate"><span class="pre">v2</span></code> or <code class="docutils literal notranslate"><span class="pre">any</span></code> for the messenger
protocol. If the prefix is not specified, <code class="docutils literal notranslate"><span class="pre">v2</span></code> protocol is used. Please see
<a class="reference internal" href="../msgr2/#address-formats"><span class="std std-ref">地址格式</span></a> for more details.</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">v1:1.2.3.4:567</span></code>, <code class="docutils literal notranslate"><span class="pre">v2:1.2.3.4:567</span></code>, <code class="docutils literal notranslate"><span class="pre">1.2.3.4:567</span></code>, <code class="docutils literal notranslate"><span class="pre">2409:8a1e:8fb6:aa20:1260:4bff:fe92:18f5::567</span></code>, <code class="docutils literal notranslate"><span class="pre">[::1]:6789</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">addrvec</span></code></dt>
<dd><p>a set of addresses separated by “,”. The addresses can be optionally quoted with <code class="docutils literal notranslate"><span class="pre">[</span></code> and <code class="docutils literal notranslate"><span class="pre">]</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">[v1:1.2.3.4:567,v2:1.2.3.4:568]</span></code>, <code class="docutils literal notranslate"><span class="pre">v1:1.2.3.4:567,v1:1.2.3.14:567</span></code>  <code class="docutils literal notranslate"><span class="pre">[2409:8a1e:8fb6:aa20:1260:4bff:fe92:18f5::567],</span> <span class="pre">[2409:8a1e:8fb6:aa20:1260:4bff:fe92:18f5::568]</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">uuid</span></code></dt>
<dd><p>the string format of a uuid defined by <a class="reference external" href="https://www.ietf.org/rfc/rfc4122.txt">RFC4122</a>.
And some variants are also supported, for more details, see
<a class="reference external" href="https://www.boost.org/doc/libs/1_74_0/libs/uuid/doc/uuid.html#String%20Generator">Boost document</a>.</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">f81d4fae-7dec-11d0-a765-00a0c91e6bf6</span></code></p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">size</span></code></dt>
<dd><p>denotes a 64-bit unsigned integer. Both SI prefixes and IEC prefixes are
supported. And “B” is the only supported unit. A negative value will be
rejected.</p>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">1Ki</span></code>, <code class="docutils literal notranslate"><span class="pre">1K</span></code>, <code class="docutils literal notranslate"><span class="pre">1KiB</span></code> and <code class="docutils literal notranslate"><span class="pre">1B</span></code>.</p>
</dd>
</dl>
</dd></dl>

<dl class="describe">
<dt>
<code class="sig-name descname"><span class="pre">secs</span></code></dt>
<dd><p>denotes a duration of time. By default the unit is second if not specified.
Following units of time are supported:</p>
<blockquote>
<div><ul class="simple">
<li><p>second: “s”, “sec”, “second”, “seconds”</p></li>
<li><p>minute: “m”, “min”, “minute”, “minutes”</p></li>
<li><p>hour: “hs”, “hr”, “hour”, “hours”</p></li>
<li><p>day: “d”, “day”, “days”</p></li>
<li><p>week: “w”, “wk”, “week”, “weeks”</p></li>
<li><p>month: “mo”, “month”, “months”</p></li>
<li><p>year: “y”, “yr”, “year”, “years”</p></li>
</ul>
</div></blockquote>
<dl class="field-list simple">
<dt class="field-odd">Example</dt>
<dd class="field-odd"><p><code class="docutils literal notranslate"><span class="pre">1</span> <span class="pre">m</span></code>, <code class="docutils literal notranslate"><span class="pre">1m</span></code> and <code class="docutils literal notranslate"><span class="pre">1</span> <span class="pre">week</span></code></p>
</dd>
</dl>
</dd></dl>

</div>
</div>
<div class="section" id="ceph-conf-database">
<span id="id10"></span><h2>监视器配置数据库<a class="headerlink" href="#ceph-conf-database" title="Permalink to this headline">¶</a></h2>
<p>The monitor cluster manages a database of configuration options that
can be consumed by the entire cluster, enabling streamlined central
configuration management for the entire system.  The vast majority of
configuration options can and should be stored here for ease of
administration and transparency.</p>
<p>A handful of settings may still need to be stored in local
configuration files because they affect the ability to connect to the
monitors, authenticate, and fetch configuration information.  In most
cases this is limited to the <code class="docutils literal notranslate"><span class="pre">mon_host</span></code> option, although this can
also be avoided through the use of DNS SRV records.</p>
<div class="section" id="id11">
<h3>段落和掩码<a class="headerlink" href="#id11" title="Permalink to this headline">¶</a></h3>
<p>Configuration options stored by the monitor can live in a global
section, daemon type section, or specific daemon section, just like
options in a configuration file can.</p>
<p>In addition, options may also have a <em>mask</em> associated with them to
further restrict which daemons or clients the option applies to.
Masks take two forms:</p>
<ol class="arabic simple">
<li><p><code class="docutils literal notranslate"><span class="pre">type:location</span></code> where <em>type</em> is a CRUSH property like <cite>rack</cite> or
<cite>host</cite>, and <em>location</em> is a value for that property.  For example,
<code class="docutils literal notranslate"><span class="pre">host:foo</span></code> would limit the option only to daemons or clients
running on a particular host.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">class:device-class</span></code> where <em>device-class</em> is the name of a CRUSH
device class (e.g., <code class="docutils literal notranslate"><span class="pre">hdd</span></code> or <code class="docutils literal notranslate"><span class="pre">ssd</span></code>).  For example,
<code class="docutils literal notranslate"><span class="pre">class:ssd</span></code> would limit the option only to OSDs backed by SSDs.
(This mask has no effect for non-OSD daemons or clients.)</p></li>
</ol>
<p>When setting a configuration option, the <cite>who</cite> may be a section name,
a mask, or a combination of both separated by a slash (<code class="docutils literal notranslate"><span class="pre">/</span></code>)
character.  For example, <code class="docutils literal notranslate"><span class="pre">osd/rack:foo</span></code> would mean all OSD daemons
in the <code class="docutils literal notranslate"><span class="pre">foo</span></code> rack.</p>
<p>When viewing configuration options, the section name and mask are
generally separated out into separate fields or columns to ease readability.</p>
</div>
<div class="section" id="id12">
<h3>命令<a class="headerlink" href="#id12" title="Permalink to this headline">¶</a></h3>
<p>The following CLI commands are used to configure the cluster:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">dump</span></code> will dump the entire configuration database for
the cluster.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">get</span> <span class="pre">&lt;who&gt;</span></code> will dump the configuration for a specific
daemon or client (e.g., <code class="docutils literal notranslate"><span class="pre">mds.a</span></code>), as stored in the monitors’
configuration database.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">set</span> <span class="pre">&lt;who&gt;</span> <span class="pre">&lt;option&gt;</span> <span class="pre">&lt;value&gt;</span></code> will set a configuration
option in the monitors’ configuration database.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">show</span> <span class="pre">&lt;who&gt;</span></code> will show the reported running
configuration for a running daemon.  These settings may differ from
those stored by the monitors if there are also local configuration
files in use or options have been overridden on the command line or
at run time.  The source of the option values is reported as part
of the output.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">assimilate-conf</span> <span class="pre">-i</span> <span class="pre">&lt;input</span> <span class="pre">file&gt;</span> <span class="pre">-o</span> <span class="pre">&lt;output</span> <span class="pre">file&gt;</span></code>
will ingest a configuration file from <em>input file</em> and move any
valid options into the monitors’ configuration database.  Any
settings that are unrecognized, invalid, or cannot be controlled by
the monitor will be returned in an abbreviated config file stored in
<em>output file</em>.  This command is useful for transitioning from legacy
configuration files to centralized monitor-based configuration.</p></li>
</ul>
</div>
</div>
<div class="section" id="id13">
<h2>帮助信息<a class="headerlink" href="#id13" title="Permalink to this headline">¶</a></h2>
<p>You can get help for a particular option with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">config</span> <span class="n">help</span> <span class="o">&lt;</span><span class="n">option</span><span class="o">&gt;</span>
</pre></div>
</div>
<p>Note that this will use the configuration schema that is compiled into the running monitors.  If you have a mixed-version cluster (e.g., during an upgrade), you might also want to query the option schema from a specific running daemon:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">daemon</span> <span class="o">&lt;</span><span class="n">name</span><span class="o">&gt;</span> <span class="n">config</span> <span class="n">help</span> <span class="p">[</span><span class="n">option</span><span class="p">]</span>
</pre></div>
</div>
<p>For example,:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph config help log_file
log_file - path to log file
  (std::string, basic)
  Default (non-daemon):
  Default (daemon): /var/log/ceph/$cluster-$name.log
  Can update at runtime: false
  See also: [log_to_stderr,err_to_stderr,log_to_syslog,err_to_syslog]
</pre></div>
</div>
<p>or:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph config help log_file -f json-pretty
{
    &quot;name&quot;: &quot;log_file&quot;,
    &quot;type&quot;: &quot;std::string&quot;,
    &quot;level&quot;: &quot;basic&quot;,
    &quot;desc&quot;: &quot;path to log file&quot;,
    &quot;long_desc&quot;: &quot;&quot;,
    &quot;default&quot;: &quot;&quot;,
    &quot;daemon_default&quot;: &quot;/var/log/ceph/$cluster-$name.log&quot;,
    &quot;tags&quot;: [],
    &quot;services&quot;: [],
    &quot;see_also&quot;: [
        &quot;log_to_stderr&quot;,
        &quot;err_to_stderr&quot;,
        &quot;log_to_syslog&quot;,
        &quot;err_to_syslog&quot;
    ],
    &quot;enum_values&quot;: [],
    &quot;min&quot;: &quot;&quot;,
    &quot;max&quot;: &quot;&quot;,
    &quot;can_update_at_runtime&quot;: false
}
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">level</span></code> property can be any of <cite>basic</cite>, <cite>advanced</cite>, or <cite>dev</cite>.
The <cite>dev</cite> options are intended for use by developers, generally for
testing purposes, and are not recommended for use by operators.</p>
</div>
<div class="section" id="id14">
<h2>运行时改配置<a class="headerlink" href="#id14" title="Permalink to this headline">¶</a></h2>
<p>大多数情况下， Ceph 都允许在运行时更改守护进程的配置。此功能在增加/降低日志输出、启用/禁用调试设置、甚至是运行时优化的时候非常有用。</p>
<p>Generally speaking, configuration options can be updated in the usual
way via the <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">set</span></code> command.  For example, do enable the debug log level on a specific OSD,:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">config</span> <span class="nb">set</span> <span class="n">osd</span><span class="mf">.123</span> <span class="n">debug_ms</span> <span class="mi">20</span>
</pre></div>
</div>
<p>Note that if the same option is also customized in a local
configuration file, the monitor setting will be ignored (it has a
lower priority than the local config file).</p>
<div class="section" id="id15">
<h3>覆盖值<a class="headerlink" href="#id15" title="Permalink to this headline">¶</a></h3>
<p>You can also temporarily set an option using the <cite>tell</cite> or <cite>daemon</cite>
interfaces on the Ceph CLI.  These <em>override</em> values are ephemeral in
that they only affect the running process and are discarded/lost if
the daemon or process restarts.</p>
<p>Override values can be set in two ways:</p>
<ol class="arabic">
<li><p>From any host, we can send a message to a daemon over the network with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">tell</span> <span class="o">&lt;</span><span class="n">name</span><span class="o">&gt;</span> <span class="n">config</span> <span class="nb">set</span> <span class="o">&lt;</span><span class="n">option</span><span class="o">&gt;</span> <span class="o">&lt;</span><span class="n">value</span><span class="o">&gt;</span>
</pre></div>
</div>
<p>For example,:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">tell</span> <span class="n">osd</span><span class="mf">.123</span> <span class="n">config</span> <span class="nb">set</span> <span class="n">debug_osd</span> <span class="mi">20</span>
</pre></div>
</div>
<p>The <cite>tell</cite> command can also accept a wildcard for the daemon
identifier.  For example, to adjust the debug level on all OSD
daemons,:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">tell</span> <span class="n">osd</span><span class="o">.*</span> <span class="n">config</span> <span class="nb">set</span> <span class="n">debug_osd</span> <span class="mi">20</span>
</pre></div>
</div>
</li>
<li><p>From the host the process is running on, we can connect directly to
the process via a socket in <code class="docutils literal notranslate"><span class="pre">/var/run/ceph</span></code> with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">daemon</span> <span class="o">&lt;</span><span class="n">name</span><span class="o">&gt;</span> <span class="n">config</span> <span class="nb">set</span> <span class="o">&lt;</span><span class="n">option</span><span class="o">&gt;</span> <span class="o">&lt;</span><span class="n">value</span><span class="o">&gt;</span>
</pre></div>
</div>
<p>For example,:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">daemon</span> <span class="n">osd</span><span class="mf">.4</span> <span class="n">config</span> <span class="nb">set</span> <span class="n">debug_osd</span> <span class="mi">20</span>
</pre></div>
</div>
</li>
</ol>
<p>Note that in the <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">show</span></code> command output these temporary
values will be shown with a source of <code class="docutils literal notranslate"><span class="pre">override</span></code>.</p>
</div>
</div>
<div class="section" id="id16">
<h2>查看运行时配置<a class="headerlink" href="#id16" title="Permalink to this headline">¶</a></h2>
<p>You can see the current options set for a running daemon with the <code class="docutils literal notranslate"><span class="pre">ceph</span> <span class="pre">config</span> <span class="pre">show</span></code> command.  For example,:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">config</span> <span class="n">show</span> <span class="n">osd</span><span class="mf">.0</span>
</pre></div>
</div>
<p>will show you the (non-default) options for that daemon.  You can also look at a specific option with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">config</span> <span class="n">show</span> <span class="n">osd</span><span class="mf">.0</span> <span class="n">debug_osd</span>
</pre></div>
</div>
<p>or view all options (even those with default values) with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">config</span> <span class="n">show</span><span class="o">-</span><span class="k">with</span><span class="o">-</span><span class="n">defaults</span> <span class="n">osd</span><span class="mf">.0</span>
</pre></div>
</div>
<p>You can also observe settings for a running daemon by connecting to it from the local host via the admin socket.  For example,:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">daemon</span> <span class="n">osd</span><span class="mf">.0</span> <span class="n">config</span> <span class="n">show</span>
</pre></div>
</div>
<p>will dump all current settings,:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">daemon</span> <span class="n">osd</span><span class="mf">.0</span> <span class="n">config</span> <span class="n">diff</span>
</pre></div>
</div>
<p>will show only non-default settings (as well as where the value came from: a config file, the monitor, an override, etc.), and:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span> <span class="n">daemon</span> <span class="n">osd</span><span class="mf">.0</span> <span class="n">config</span> <span class="n">get</span> <span class="n">debug_osd</span>
</pre></div>
</div>
<p>will report the value of a single option.</p>
</div>
<div class="section" id="nautilus">
<h2>nautilus 以来的变化<a class="headerlink" href="#nautilus" title="Permalink to this headline">¶</a></h2>
<p>Octopus 版改变了配置文件的分析方式，改变的地方有：</p>
<ul>
<li><p>Repeated configuration options are allowed, and no warnings will be printed.
The value of the last one is used, which means that the setting last in the file
is the one that takes effect. Before this change, we would print warning messages
when lines with duplicated options were encountered, like:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">warning</span> <span class="n">line</span> <span class="mi">42</span><span class="p">:</span> <span class="s1">&#39;foo&#39;</span> <span class="ow">in</span> <span class="n">section</span> <span class="s1">&#39;bar&#39;</span> <span class="n">redefined</span>
</pre></div>
</div>
</li>
<li><p>Invalid UTF-8 options were ignored with warning messages. But since Octopus,
they are treated as fatal errors.</p></li>
<li><p>Backslash <code class="docutils literal notranslate"><span class="pre">\</span></code> is used as the line continuation marker to combine the next
line with current one. Before Octopus, it was required to follow a backslash with
a non-empty line. But in Octopus, an empty line following a backslash is now allowed.</p></li>
<li><p>In the configuration file, each line specifies an individual configuration
option. The option’s name and its value are separated with <code class="docutils literal notranslate"><span class="pre">=</span></code>, and the
value may be quoted using single or double quotes. If an invalid
configuration is specified, we will treat it as an invalid configuration
file</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">bad</span> <span class="n">option</span> <span class="o">====</span> <span class="n">bad</span> <span class="n">value</span>
</pre></div>
</div>
</li>
<li><p>Before Octopus, if no section name was specified in the configuration file,
all options would be set as though they were within the <a class="reference internal" href="#confsec-global"><code class="xref std std-confsec docutils literal notranslate"><span class="pre">global</span></code></a> section. This is
now discouraged. Since Octopus, only a single option is allowed for
configuration files without a section name.</p></li>
</ul>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../common/" class="btn btn-neutral float-right" title="通用选项" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../storage-devices/" class="btn btn-neutral float-left" title="存储设备" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>